package com.foreknow.demo16;

public class SleepDemo {
    public static void main(String[] args) {
        new Thread("线程1"){
            public void run() {
                for (int i = 0;i<100;i++){
                    //线程休眠
                    try {
                        Thread.sleep(1500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(getName()+"执行了！！！！！！");
                }
            }
        }.start();

        new Thread("线程2"){
            public void run() {
                for (int i = 0;i<100;i++){
                    //线程休眠
                    try {
                        Thread.sleep(1500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(getName()+"执行了！！！！！！");
                }
            }
        }.start();
    }
}
